﻿#region Copyright (c) 09/19/2012, Olaf Kober <amarok.projects@gmail.com>
//================================================================================
//	Permission is hereby granted, free of charge, to any person obtaining a copy
//	of this software and associated documentation files (the "Software"), to deal
//	in the Software without restriction, including without limitation the rights
//	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//	copies of the Software, and to permit persons to whom the Software is
//	furnished to do so, subject to the following conditions:
//
//	The above copyright notice and this permission notice shall be included in
//	all copies or substantial portions of the Software.
//
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//	THE SOFTWARE.
//================================================================================
#endregion

using System;
using Amarok.Agents;


namespace Amarok.Presentation
{
	/// <summary>
	/// This view action requests the view to show a modal dialog window specified by the supplied window description. 
	/// The shown dialog window can return a dialog result, which is then stored into this view action, so that the 
	/// issuer of this view action can access the dialog result after the dialog has been closed.
	/// </summary>
	public class ShowDialogAction : ViewAction
	{
		/// <summary>
		/// Gets the window description that specifies which dialog window should be shown.
		/// </summary>
		public WindowDescription WindowDescription
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets a reference to the agent's environment. The agent environment is used to give agents access to 
		/// the services of the runtime environment. One agent environment instance is shared between multiple 
		/// agents to provide the same services to all agents.
		/// </summary>
		public AgentEnvironment Environment
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets a reference to the agent's options. Agent options can be used to provide agent instances with 
		/// individual configurations and settings.
		/// </summary>
		public AgentOptions Options
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets or sets the dialog result of the shown dialog window. This property is set with the dialog result 
		/// after the shown dialog window has been closed.
		/// </summary>
		public Nullable<Boolean> DialogResult
		{
			get;
			set;
		}


		/// <summary>
		/// Initializes a new instance.
		/// </summary>
		/// 
		/// <param name="windowDescription">
		/// The window description that specifies which dialog window should be shown.</param>
		/// <param name="environment">
		/// The agent environment that should be forwarded to the window's controller.</param>
		/// <param name="options">
		/// The agent options that should be forwarded to the window's controller.</param>
		/// 
		/// <exception cref="ArgumentNullException">
		/// A null reference was passed to a method that did not accept it as a valid argument.</exception>
		public ShowDialogAction(WindowDescription windowDescription, AgentEnvironment environment, AgentOptions options)
		{
			Verify.NotNull(windowDescription, "windowDescription");
			Verify.NotNull(environment, "environment");
			Verify.NotNull(options, "options");

			this.WindowDescription = windowDescription;
			this.Environment = environment;
			this.Options = options;
		}

	}
}
